<?
#####################################################
#  COPYRIGHT NOTICE
#####################################################
# In the following statements, the term "this 
# program" refers to all files associated with the
# execution and distribution of Adtrackz.
#
# This Program is Copyright 2004 Jonah Klimack.
# All Rights Reserved. 
#
# Selling the code for this program, modifying 
# and/or redistributing the code for this program
# in part or in whole over the Internet or in any 
# other medium is expressly forbidden. Violators
# will be prosecuted to the fullest extent of the law
# Copyright and header information may not be
# modified.
#
# This program is distributed "as is" and without 
# warranty of any kind, either express or implied.
# In no event shall the liability of Jonah Klimack 
# for any damages, losses and/or causes of 
# action exceed the total amount paid by the 
# user for this software.		
#####################################################
# DO NOT MODIFY ANYTHING IN THIS FILE
#####################################################


require "header.php";

?>

<p class="small" align="left">
Campaigns > Statistics > Preferences
</p>
<p class="heading">
Statistic Preferences
</p>

<table width="100%">
<tr>
	<td>Customize your statistics report.</td>
	<td align="right"><a href="stats.php">Back to Statistics...</td>
</tr>
</table>


<?

if ($submit)
{
	mysql_query("update adtrackz_preferences set clicks='$clicks', rawclicks='$rawclicks', actions='$actions', sales='$sales', cpc='$cpc',  cpa='$cpa', cps='$cps', cts='$cts', cta='$cta', cost='$cost',  revenue='$rev', profit='$profit', roi='$roi', purpose='$purpose', group1='$group1', status='$status', timeperiod='$timeperiod', column_purpose='$column_purpose', column_group = '$column_group', description='$description', campaign_display='$campaign_display', subcampaign_display = '$subcampaign_display'");

	echo mysql_error();
	
	echo "<br><br>";
	echo "cta: $cta   cts: $cts";
	alert("Your preferences have been updated.");
}
else //load them up
{
	list($clicks, $rawclicks, $actions, $sales, $cpc, $cpa, $cps, $cta, $cts, $cost, $rev, $profit, $roi, $purpose, $group1, $status, $timeperiod, $column_purpose, $column_group, $description, $campaign_display, $subcampaign_display) = mysql_fetch_row(mysql_query("select * from adtrackz_preferences"));
}


?>

<br><br>
<u>Section 1: Display Preferences</u>

<p>Select the columns you would like to display for the statistics report.</p>
<form action="preferences.php" method="post">
<table width="500" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="white"  bordercolor="white">
<tr>
	<td valign="top">
		<input type="checkbox" name="rawclicks" value="checked" <?=$rawclicks?>> 		
	</td>
	<td valign="top">Raw Clicks</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="clicks" value="checked" <?=$clicks?>> 		
	</td>
	<td valign="top">Clicks</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="actions" value="checked" <?=$actions?>> 		
	</td>
	<td valign="top">Actions</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="sales" value="checked" <?=$sales?>> 		
	</td>
	<td valign="top">Sales</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="cpc" value="checked" <?=$cpc?>> 		
	</td>
	<td valign="top">Cost Per Click (CPC)</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="cpa" value="checked" <?=$cpa?>> 		
	</td>
	<td valign="top">Cost Per Action (CPA)</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="cps" value="checked" <?=$cps?>> 		
	</td>
	<td valign="top">Cost Per Sale (CPS)</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="cta" value="checked" <?=$cta?>> 		
	</td>
	<td valign="top">Clicks to Actions % (CTA)</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="cts" value="checked" <?=$cts?>> 		
	</td>
	<td valign="top">Clicks to Sales % (CTS)</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="cost" value="checked" <?=$cost?>> 		
	</td>
	<td valign="top">Cost</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="rev" value="checked" <?=$rev?>> 		
	</td>
	<td valign="top">Revenue</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="profit" value="checked" <?=$profit?>> 		
	</td>
	<td valign="top">Profit</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="roi" value="checked" <?=$roi?>> 		
	</td>
	<td valign="top">R.O.I.</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="column_purpose" value="checked" <?=$column_purpose?>> 		
	</td>
	<td valign="top">Purpose</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="column_group" value="checked" <?=$column_group?>> 		
	</td>
	<td valign="top">Group</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="description" value="checked" <?=$description?>> 		
	</td>
	<td valign="top">Description</td>
</tr>
</table>

<br><br>
<u>Section 2: Starting Preferences</u>

<p>Select the starting values you would like for the filter to have when you load the statistic report from the menu. This allows you to click one button after you login and get your favourite stats report immediately.</p>

<table width="500" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="white"  bordercolor="white">
<tr>
	<td valign="top">
		<?
			if ($purpose == "all purposes")
				$all_purposes_selected = "selected";
			elseif ($purpose == "clicks")
				$clicks_selected = "selected";
			elseif ($purpose == "actions")
				$actions_selected = "selected";
			elseif ($purpose == "sales")
				$sales_selected == "selected";
			elseif ($purpose == "all")
				$all_selected == "selected";
			elseif ($purpose == "affiliate")
				$affiliate_selected == "selected";
		?>
		<select name="purpose" class="small">
		<option value="all purposes" <?=$all_purposes_selected?>>All</option>
		<option value="clicks" <?=$clicks_selected?>>Clicks Only</option>
		<option value="actions" <?=$actions_selected?>>Clicks & Actions</option>
		<option value="sales" <?=$sales_selected?>>Clicks & Sales</option>
		<option value="all" <?=$all_selected?>>Clicks, Actions & Sales</option>
		<option value="affiliate" <?=$affiliate_selected?>>Affiliate Link</option>
		</select>
		
	</td>
	<td valign="top">Starting Purpose</td>
</tr>
<tr>
	<td valign="top">
		<select name="group1" class="small">
		<?
			if ($group1 == "all")
				echo "<option value=all selected>All</option>";
			else
				echo "<option value=all>All</option>";
			$groups = mysql_query("select * from adtrackz_groups");
			while($group2 = mysql_fetch_row($groups))
			{
				if ($group1 == $group2[0])
					echo "<option value=$group2[0] selected>$group2[1]</option>";
				else
					echo "<option value=$group2[0]>$group2[1]</option>";
			}
		?>
		</select>
	</td>
	<td valign="top">Starting Group</td>
</tr>
<tr>
	<td>
		<?
			if ($status == "all")
				$s_all_selected = "selected";
			elseif ($status == "active")
				$s_active_selected = "selected";
			elseif ($status == "ended")
				$s_ended_selected = "selected";
			elseif ($status == "pending")
				$s_pending_selected = "selected";
		?>
		<select name="status" class="small">
		<option value="all" <?=$s_all_selected?>>All</option>
		<option value="pending" <?=$s_pending_selected?>>pending</option>
		<option value="active" <?=$s_active_selected?>>active</option>
		<option value="ended" <?=$s_ended_selected?>>ended</option>
		</select> 
	</td>
	<td valign="top">Starting Status</td>
</tr>
<tr>
	<td valign="top">
		<?
			if ($timeperiod == "all")
				$tp_all_selected = "selected";
			elseif ($timeperiod == "today")
				$tp_today_selected = "selected";
			elseif ($timeperiod == "yesterday")
				$tp_yesterday_selected = "selected";
			elseif ($timeperiod == "thisweek")
				$tp_thisweek_selected = "selected";
			elseif ($timeperiod == "lastweek")
				$tp_lastweek_selected = "selected";
			elseif ($timeperiod == "thismonth")
				$tp_thismonth_selected = "selected";
			elseif ($timeperiod == "lastmonth")
				$tp_lastmonth_selected = "selected";
			elseif ($timeperiod == "thisyear")
				$tp_thisyear_selected = "selected";
			elseif ($timeperiod == "lastyear")
				$tp_lastyear_selected = "selected";
		?>
		<select name="timeperiod" class="small">
		<option value="all" <?=$tp_all_selected?>>All Clicks</option>
		<option value="today" <?=$tp_today_selected?>>Today</option>
		<option value="yesterday" <?=$tp_yesterday_selected?>>Yesterday</option>
		<option value="thisweek" <?=$tp_thisweek_selected?>>This Week</option>
		<option value="lastweek" <?=$tp_lastweek_selected?>>Last Week</option>
		<option value="thismonth" <?=$tp_thismonth_selected?>>This Month</option>
		<option value="lastmonth" <?=$tp_lastmonth_selected?>>Last Month</option>
		<option value="thisyear" <?=$tp_thisyear_selected?>>This Year</option>
		<option value="lastyear" <?=$tp_lastyear_selected?>>Last Year</option>
		</select>
	</td>
	<td valign="top">Starting Time Period</td>
</tr>
</table>
<br><br>
<br><br>
<u>Section 3: Campaign Display Preferences</u>

<p>
When there are a lot of campaigns to track, your statistics report can look slightly overwhelming. This section was created to help clean up the clutter.
</p>
<p>
If there are no clicks, actions or sales for a given campaign or subcampaign for the time period you are chosen, by default, AdTrackzGold will NOT display these campaigns or subcampaigns.
</p>
<p>
However, if you would like to change this behaviour, you can uncheck these and AdTrackzGold will display all campaigns or subcampaigns for the time period you have chosen regardless if there was activity.
</p>
<table width="500" border="0" cellspacing="0" cellpadding="5" align="center" bgcolor="white"  bordercolor="white">
<tr>
	<td valign="top">
		<input type="checkbox" name="campaign_display" value="checked" <?=$campaign_display?>> 		
	</td>
	<td valign="top">If there is no campaign activity in selected time period, do not display these campaigns.</td>
</tr>
<tr>
	<td valign="top">&nbsp;
		
	</td>
	<td valign="top">&nbsp;</td>
</tr>
<tr>
	<td valign="top">
		<input type="checkbox" name="subcampaign_display" value="checked" <?=$subcampaign_display?>> 		
	</td>
	<td valign="top">If there is no subcampaign activity in selected time period, do not display these subcampaigns</td>
</tr>
</table>


<br><br>


<center>
<input type="submit" name="submit"  value="Save Changes"  > 		
</center>
</form>



<?
require "footer.php";
?>